<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <iframe id="iframeAA" style="width: 100%; height: 100%" src="http://127.0.0.1:5502/form.html" @load="handleLoad"></iframe>
  <iframe id="iframeBB" style="width: 100%; height: 100%" src="http://192.168.218.53:3000" @load="handleLoad"></iframe>
  <button>点击</button>
  <!-- > Network:  http://192.168.32.21:3000/
  > Network:  http://192.168.218.53:3000/
  > Local:    http://localhost:3000/    -->
  <script>
    const getTest = () => {
      //["updateDubanForm"]这一部分是调用iframe里的方法命，里面"updateDubanForm"可以换成一个变量.
      //也可以写成iframe_home.contentWindow.updateDubanForm(type);
      // iframe_home.contentWindow["updateDubanForm"](type);
      console.log(document.getElementById('iframeAA').contentWindow, 'iframeAAiframeAA')
      console.log(document.getElementById('iframeBB').contentWindow, 'iframeBBiframeBB')
      const iframe = document.getElementById('iframeBB')
      const iframeDocument = iframe.contentDocument || iframe.contentWindow;
      // 获取 Vue 实例挂载的 DOM 元素
      // var appElement = iframeDocument.getElementById('app');

      // 获取 Vue 实例
      // var vueInstance = appElement.__vue__;
      console.log(iframeDocument); // 输出 Vue 实例
      // document.getElementById('iframeBB').onload = (e) => {
      //   console.log(e, 'onloadonload')
      // }
    }
    setTimeout(() => {
      getTest()
    }, 2000);
  </script>
</body>
</html>